<?php

/**
 * Alerte form base class.
 *
 * @method Alerte getObject() Returns the current form's model object
 *
 * @package    symfony
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseAlerteForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'                   => new sfWidgetFormInputHidden(),
      'id_departement'       => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Departement'), 'add_empty' => false)),
      'categorie'            => new sfWidgetFormInputCheckbox(),
      'objet'                => new sfWidgetFormInputText(),
      'reference'            => new sfWidgetFormInputText(),
      'date_creation'        => new sfWidgetFormDate(),
      'date_traitement'      => new sfWidgetFormDate(),
      'traiter'              => new sfWidgetFormInputCheckbox(),
      'supprimer'            => new sfWidgetFormInputCheckbox(),
      'masquer'              => new sfWidgetFormInputCheckbox(),
      'date_masquer'         => new sfWidgetFormDate(),
      'description'          => new sfWidgetFormTextarea(),
      'traitement'           => new sfWidgetFormTextarea(),
      'recommendation'       => new sfWidgetFormTextarea(),
      'frequence_alerte'     => new sfWidgetFormInputText(),
      'duree_masque'         => new sfWidgetFormInputText(),
      'parametre_traitement' => new sfWidgetFormInputText(),
      'created_at'           => new sfWidgetFormDateTime(),
      'updated_at'           => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'id'                   => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'id_departement'       => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Departement'))),
      'categorie'            => new sfValidatorBoolean(),
      'objet'                => new sfValidatorString(array('max_length' => 128)),
      'reference'            => new sfValidatorString(array('max_length' => 64)),
      'date_creation'        => new sfValidatorDate(),
      'date_traitement'      => new sfValidatorDate(array('required' => false)),
      'traiter'              => new sfValidatorBoolean(),
      'supprimer'            => new sfValidatorBoolean(),
      'masquer'              => new sfValidatorBoolean(),
      'date_masquer'         => new sfValidatorDate(array('required' => false)),
      'description'          => new sfValidatorString(array('max_length' => 1024)),
      'traitement'           => new sfValidatorString(array('max_length' => 1024)),
      'recommendation'       => new sfValidatorString(array('max_length' => 1024)),
      'frequence_alerte'     => new sfValidatorInteger(array('required' => false)),
      'duree_masque'         => new sfValidatorInteger(array('required' => false)),
      'parametre_traitement' => new sfValidatorInteger(),
      'created_at'           => new sfValidatorDateTime(),
      'updated_at'           => new sfValidatorDateTime(),
    ));

    $this->widgetSchema->setNameFormat('alerte[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Alerte';
  }

}
